package com.faxsun.profile.core.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.broadleafcommerce.profile.core.domain.Customer;
import org.broadleafcommerce.profile.core.domain.CustomerImpl;
import org.hibernate.annotations.Index;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "FS_ASSISTANT")
public class FSAssistantImpl implements FSAssistant {
	
	@Id
	@Column(name = "MD5_ID")
	protected String md5Id;
	
	@Column(name = "IS_DEACTIVED", columnDefinition="bit(1) default 0")
	protected boolean deactived;
	
	@ManyToOne(targetEntity = CustomerImpl.class, optional=false)
    @JoinColumn(name = "CUSTOMER_ID", nullable = false)
    @Index(name="ORDER_CUSTOMER_INDEX", columnNames={"CUSTOMER_ID"})
    protected Customer customer;

	@Override
	public void setMD5(String md5) {
		this.md5Id = md5;
	}

	@Override
	public Customer getCustomer() {	 
		return customer;
	}

	@Override
	public void setCustomer(Customer customer) {
        this.customer = customer; 	
	}

	@Override
	public void setDeactived(boolean deactived) {
		this.deactived = deactived;
	}

	@Override
	public boolean getDeactived() {
		return deactived;
	}

}
